<!DOCTYPE html>
<%@page contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="/tld/authority.tld" prefix="authority" %>
<%@taglib uri="/tld/token.tld" prefix="token" %>

<div class="pop-background">
    <div class="col-md-4">
        <div class="popup popup5 popup-small x-4-move">
            <div class="panel-heading">
                <div class="panel-btns">
                    <a class="panel-close btn-4-hide">×</a>
                </div>
                <h3 class="panel-title">${empty categoryParam.id ? '新增属性关联' : '修改属性关联'}</h3>
            </div>
            <div class="panel-add-to">
                <div class="row">
                    <form>
                        <token:token/>
                        <input type="hidden" name="id" value="${categoryParam.id}" />
                        <input type="hidden" name="paramData" value='${categoryParam.paramData}' />
                        <input type="hidden" name="categoryId" value="${categoryParam.categoryId}" />
                        <input type="hidden" name="level" value="${categoryParam.level}" />
                        <div class="panel-body panel-body-ws panel-body-h">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">一级类别名称：</label>

                                    <div class="col-sm-6">
                                        <div class="select-container select">
                                            <c:choose>
                                                <c:when test="${empty categoryParam.id}">
                                                    <select class="select select-offscreen Lv1" name="levelOne">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${levelOneList}" var="item">
                                                            <option value="${item.id}" ${item.id == levelOne.id ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </c:when>
                                                <c:otherwise>
                                                    <input type="text" class="form-control" value="${levelOne.name}" readonly />
                                                    <input type="hidden" name="levelOne" value="${levelOne.id}" />
                                                </c:otherwise>
                                            </c:choose>

                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">二级类别名称：</label>

                                    <div class="col-sm-6">
                                        <div class="select-container select">
                                            <c:choose>
                                                <c:when test="${empty categoryParam.id}">
                                                    <select class="select select-offscreen Lv2" name="levelTwo">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${levelTwoList}" var="item">
                                                            <option value="${item.id}" ${item.id == levelTwo.id ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </c:when>
                                                <c:otherwise>
                                                    <input type="text" class="form-control" value="${levelTwo.name}" readonly />
                                                    <input type="hidden" name="levelTwo" value="${levelTwo.id}" />
                                                </c:otherwise>
                                            </c:choose>

                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">关联属性：</label>

                                    <div class="col-sm-6 attrVal-content">
                                        <label style="margin-bottom: 10px; color: red;"><input type="checkbox" class="checkAll" />关联全部属性</label>
                                        <div class="attrContent">
                                        <c:forEach items="${attributeList}" var="item">
                                            <label style="margin-right: 10px;"><input type="checkbox" name="val" value="${item.name}" ${paramDataList.contains(item.name)?"checked":""} />${item.name}</label>
                                        </c:forEach>
                                        <c:forEach items="${oldParamDataList}" var="item">
                                            <label style="margin-right: 10px;"><input type="checkbox" name="val" value="${item}" checked />${item}</label>
                                        </c:forEach>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </form>
                </div>

                <div class="btn-group2-s">
                    <div class="panel-body panel-body2">
                        <div class="btn-group2 left">
                            <authority:authority url="/categoryParam/add,/categoryParam/modify">
                                <button type="button" class="btn btn-primary btn-4-save">保存</button>
                            </authority:authority>
                            <button type="button" class="btn btn-default btn-4-hide">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="js/dictionary/category-param-edit.js"></script>
</div>